package com.vietnam.power.persistence;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * The persistent class for the role_info database table.
 * 
 */
@Entity
@Table(name="role_info")
public class RoleInfo implements Serializable {
	private static final long serialVersionUID = 1L;
	private Long roleInfoId;
	private String roleDescription;
	private String roleName;
	private List<UserRole> userRoles;

	public RoleInfo() {
	}


	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="ROLE_INFO_ID")
	public Long getRoleInfoId() {
		return this.roleInfoId;
	}

	public void setRoleInfoId(Long roleInfoId) {
		this.roleInfoId = roleInfoId;
	}


	@Column(name="ROLE_DESCRIPTION")
	public String getRoleDescription() {
		return this.roleDescription;
	}

	public void setRoleDescription(String roleDescription) {
		this.roleDescription = roleDescription;
	}


	@Column(name="ROLE_NAME")
	public String getRoleName() {
		return this.roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}


	//bi-directional many-to-one association to UserRole
	@OneToMany(mappedBy="roleInfo")
	public List<UserRole> getUserRoles() {
		return this.userRoles;
	}

	public void setUserRoles(List<UserRole> userRoles) {
		this.userRoles = userRoles;
	}

	public UserRole addUserRole(UserRole userRole) {
		getUserRoles().add(userRole);
		userRole.setRoleInfo(this);

		return userRole;
	}

	public UserRole removeUserRole(UserRole userRole) {
		getUserRoles().remove(userRole);
		userRole.setRoleInfo(null);

		return userRole;
	}

}